using UnityEngine;
using UnityEngine.UI;

namespace HEFramework
{
    /// <summary>
    ///
    /// UI输入行为基类
    ///
    /// ----------------------------------------
    /// 作者：hep
    /// 创建时间：2023/05/24 22:15
    /// ----------------------------------------
    /// </summary>
    [RequireComponent(typeof(InputField))]
    public class UIInputFieldBehaviourBase : MonoBehaviour, IUIInputFieldBehaviour
    {
        private InputField inputField;

        public InputField InputField => inputField;

        public void Awake()
        {
            if (inputField == null)
            {
                inputField = transform.GetComponent<InputField>();
            }
        }

        public Transform GetTransform()
        {
            return inputField.transform;
        }

        /// <summary>
        /// 返回对象
        /// </summary>
        /// <returns></returns>
        public GameObject GetGameObject()
        {
            return inputField.gameObject;
        }
    }
}